package com.zwps.biz.controller.http;

import com.zwps.biz.domain.service.FileRecordBizSettingService;
import com.zwps.biz.api.model.dto.file.record.biz.setting.AddFileRecordBizSettingDTO;
import com.zwps.biz.api.model.dto.file.record.biz.setting.SelectFileRecordBizSettingDTO;
import com.zwps.biz.api.model.dto.file.record.biz.setting.UpdateFileRecordBizSettingDTO;
import com.zwps.biz.api.model.vo.file.record.biz.setting.SelectFileRecordBizSettingPageVO;
import com.zwps.common.controller.response.message.ResponseDataPageMessage;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

/**
 * @author shanwen
 * @description:
 * @date 2023-09-15
 * @ClassName FileRecordBizSettingController
 */
@Tag(name = "文件业务表设置")
@RestController
@RequestMapping("file/record/biz/setting")
@AllArgsConstructor
@Validated
public class FileRecordBizSettingController {

    private FileRecordBizSettingService fileRecordBizSettingService;

    @Parameter(name = "id", description = "文件业务表设置主键ID", in = ParameterIn.PATH)
    @Operation(summary = "修改文件业务表设置")
    @PutMapping("{id}")
    public void updateFileRecordBizSetting(@Valid @NotBlank @PathVariable String id,
                                              @Valid @NotNull @RequestBody UpdateFileRecordBizSettingDTO dto) {
        fileRecordBizSettingService.updateFileRecordBizSetting(id, dto);
    }

    @Operation(summary = "分页查询文件业务表设置")
    @GetMapping("page")
    public ResponseDataPageMessage<SelectFileRecordBizSettingPageVO> selectFileRecordBizSettingPage(SelectFileRecordBizSettingDTO dto) {
        return ResponseDataPageMessage.data(fileRecordBizSettingService.selectFileRecordBizSettingPage(dto));
    }

    @Operation(summary = "新增文件业务表设置")
    @PostMapping()
    public void addFileRecordBizSetting(@Valid @NotNull @RequestBody AddFileRecordBizSettingDTO dto) {
        fileRecordBizSettingService.addFileRecordBizSetting(dto);
    }

    @Operation(summary = "批量删除文件业务表设置")
    @DeleteMapping("{ids}")
    public void deleteFileRecordBizSetting(@Valid @NotBlank @PathVariable String ids) {
        fileRecordBizSettingService.deleteFileRecordBizSetting(ids);
    }
}
